#include "mainscene.h"
#include "ui_mainscene.h"
#include"qpainter.h"
#include"mypushbutton.h"
#include"qdebug.h"
MainScene::MainScene(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainScene)
{
    ui->setupUi(this);
    setFixedSize(320,588);
    setWindowIcon(QIcon(":/res/Coin0001.png"));
    setWindowTitle("mainscene");
    connect(ui->actionquit,&QAction::triggered,[=](){
        this->close();
    });



    MyPushButton * mypushbutton=new MyPushButton(":/res/MenuSceneStartButton.png");
    mypushbutton->setParent(this);
    mypushbutton->move(this->width()*0.5- mypushbutton->width()*0.5, this->height()*0.5);
    chooselevelsence=new ChooseLevelSence();
    connect(chooselevelsence,&ChooseLevelSence::choosesceneback,[=](){
        qDebug()<<"ssssss";
        chooselevelsence->hide();
        this->show();
    });
    connect(mypushbutton,&MyPushButton::clicked,[=](){
        qDebug()<<"start"<<endl;
        mypushbutton->zoom1();
         mypushbutton->zoom2();
         this->hide();
         chooselevelsence->show();

    });
}
void MainScene::paintEvent(QPaintEvent *){
    QPainter painter(this);
    QPixmap pix;
    pix.load(":/res/PlayLevelSceneBg.png");
    painter.drawPixmap(0,0,this->width(),this->height(),pix);
    pix.load(":/res/Title.png");
    pix.scaled(pix.width()*0.5,pix.height()*0.5);
    painter.drawPixmap(10,30,pix);




}
MainScene::~MainScene()
{
    delete ui;
}

